# Created by: Olivier Duchateau
# $FreeBSD$

PORTNAME=	kazam
PORTVERSION=	1.4.5
CATEGORIES=	x11
MASTER_SITES=	https://launchpadlibrarian.net/182631125/ \
	https://launchpad.net/${PORTNAME}/stable/${PORTVERSION}/+download/

MAINTAINER=	olivierd@FreeBSD.org
COMMENT=	Simple screen recording program

LICENSE=	GPLv3
LICENSE_FILE=	${WRKSRC}/COPYING

LIB_DEPENDS=	libkeybinder-3.0.so:${PORTSDIR}/x11/keybinder-gtk3
BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}distutils-extra>=2.38:${PORTSDIR}/devel/py-distutils-extra
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}dbus>=1.1:${PORTSDIR}/devel/py3-dbus \
	${PYTHON_PKGNAMEPREFIX}xdg>=0.25:${PORTSDIR}/devel/py3-xdg \
	gnome-icon-theme-symbolic>=3.6.2:${PORTSDIR}/x11-themes/gnome-icon-theme-symbolic

USES=	shebangfix gettext python:3.2+
USE_PYTHON=	distutils py3kplist
USE_GNOME=	gtk30 py3gobject3
USE_GSTREAMER1=	yes good pulse lame vorbis vpx x264 libav jpeg png ximagesrc
INSTALLS_ICONS=	yes

SHEBANG_FILES=	bin/kazam
python_CMD=	${SETENV} python

post-patch:
	${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' \
		${WRKSRC}/kazam/app.py
	${REINPLACE_CMD} -e 's|Ubuntu|${OPSYS}| ; \
		s|14\.04|${OSREL}|' ${WRKSRC}/kazam/version.py
	${FIND} ${WRKSRC} -type f -name '*.orig' \
		| ${XARGS} ${RM} -f

post-build:
	@${ECHO_CMD} "cd ${PREFIX}/libexec || exit 1" > ${WRKDIR}/run.sh
	@${ECHO_CMD} "exec ${PYTHON_CMD} kazam $$\@" >> ${WRKDIR}/run.sh
	${REINPLACE_CMD} -i "" 's|\\||' ${WRKDIR}/run.sh

post-install:
	${INSTALL_SCRIPT} ${WRKDIR}/run.sh ${STAGEDIR}${PREFIX}/bin/${PORTNAME}

.include <bsd.port.mk>
